<?php

//include_once('./functions/functions.php');
//print_r($_POST);

$visit_id = $HTTP_POST_VARS['visit_id'];
$client_id = $HTTP_POST_VARS['client_id'];

$pres_is_1 = $HTTP_POST_VARS['pres_is_1'];
$pres_is_2 = $HTTP_POST_VARS['pres_is_2'];
$pres_is_3 = $HTTP_POST_VARS['pres_is_3'];
$pres_is_4 = $HTTP_POST_VARS['pres_is_4'];

$opt_1 = $HTTP_POST_VARS['opt_1'];
$opt_2 = $HTTP_POST_VARS['opt_2'];
$opt_3 = $HTTP_POST_VARS['opt_3'];
$opt_4 = $HTTP_POST_VARS['opt_4'];

$casew = $HTTP_POST_VARS['optCCD'];
$casew_name = $HTTP_POST_VARS['casew_name'];
$casew_org = $HTTP_POST_VARS['casew_org'];

$client_sig = $HTTP_POST_VARS['optClientSignature'];

$time_taken = $HTTP_POST_VARS['txtTimeTaken'];
$duty_worker = $HTTP_POST_VARS['txtInterviewer'];

$queryVisit = "
					UPDATE er_page2 SET
pres_is_1='$pres_is_1',
pres_is_2='$pres_is_2',
pres_is_3='$pres_is_3',
pres_is_4='$pres_is_4',
opt_1='$opt_1',
opt_2='$opt_2',
opt_3='$opt_3',
opt_4='$opt_4',
casew='$casew',
casew_name='$casew_name',
casew_org='$casew_org',
client_sig='$client_sig',
time_taken='$time_taken',
duty_worker='$duty_worker'
WHERE visit_id='$visit_id'";

//echo $queryVisit;
$resultVisit = r_db($queryVisit);

if (mysql_error()) {
	echo "An error has occurred, please contact the system administrator with the following error messages:<p>";
	echo mysql_error();
	echo "</p>";
}
mysql_affected_rows();

echo "Visit updated successfully!";

include('./pages/visit_details.php');

?>
